<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>详情</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,address=no"/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../js/drop/dropload.css" />
    <link rel="stylesheet" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/main.css"/>
    <style>
        .look{
            width: 1.8rem;
            line-height:.54rem;
            border-radius: .6rem;
            box-sizing: border-box;
            color: #fb9b6c;
            border:1px solid #fb9b6c;
            font-size: .26rem;
            text-align: center;
        }
        .list li + li{
            border-top:1px solid #e5e5e5;
            box-sizing: border-box;
        }
        .list li div:nth-of-type(2),.list li div:nth-of-type(3){
            border-left: 1px solid #e5e5e5;
        }
    </style>
</head>
<body>
    <header>
        <div class="ad_list plr24 bw">
            <div class="flex_sb h130 item">
                <div>
                    <p>广告名称:<span class="ml10" id="name"></span></p>
                    <p class="col9 mt10 font13" id="time"></p>
                </div>
                <div class="look">查看曲线统计</div>
            </div>
        </div>
        <div class="flex colw lh80 mt20 tac" style="background: #ffd29d;">
            <div class="flex1">日期</div>
            <div class="flex1">点击次数</div>
            <div class="flex1">展示次数</div>
        </div>
    </header>
    <section id="list_wrap">
        <ul class="lh70 tac list">
            <!--<li class="flex bw">-->
                <!--<div class="flex1">2018-05-06</div>-->
                <!--<div class="flex1">100次</div>-->
                <!--<div class="flex1">200次</div>-->
            <!--</li>-->
            <!--<li class="flex bw">-->
                <!--<div class="flex1">2018-05-06</div>-->
                <!--<div class="flex1">100次</div>-->
                <!--<div class="flex1">200次</div>-->
            <!--</li>-->
            <!--<li class="flex bw">-->
                <!--<div class="flex1">2018-05-06</div>-->
                <!--<div class="flex1">100次</div>-->
                <!--<div class="flex1">200次</div>-->
            <!--</li>-->
        </ul>
    </section>
</body>
</html>
<script src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="../js/drop/dropload.min.js"></script>
<script src="../js/dlc.js"></script>
<script>
    dlc_request('/api/advertising/adversitingInfo',{'id':getUrlParam('id')},function(res){
        console.log(res);
        if(res.code == 1){
            $('#name').text(res.data.name);
            $('#time').text(format(res.data.createTime,'Y-m-d H:i:s'));
        }else{
            dlctipbox.show(res.msg);
        }
    });
    var page = 0;
    var totalPage;
    $('#list_wrap').dropload({
        scrollArea : window,
        domUp : {
            domClass   : 'dropload-up',
            domRefresh : '<div class="dropload-refresh">↓下拉刷新</div>',
            domUpdate  : '<div class="dropload-update">↑释放更新</div>',
            domLoad    : '<div class="dropload-load"><span class="loadings"></span>加载中...</div>'
        },
        domDown : {
            domClass   : 'dropload-down',
            domRefresh : '<div class="dropload-refresh">↑上拉加载更多</div>',
            domLoad    : '<div class="dropload-load"><span class="loadings"></span>加载中...</div>',
            domNoData  : '<div class="dropload-noData">暂无更多数据</div>'
        },
        loadUpFn : function(me){
            dlc_request('/api/advtotal/advOnLineList',{'page':1,'limit':10,'advId':getUrlParam('id')},function(res){
                console.log(res);
                if(res.code == 1){
                    var str = '';
                    totalPage = res.page.totalPage;
                    var res = res.page.list;
                    for(var i in res){
                        str+='<li class="flex bw">'+
                                '<div class="flex1">'+format(res[i].createTime,'Y-m-d')+'</div>'+
                                '<div class="flex1">'+res[i].clickNum+'次</div>'+
                        '<div class="flex1">'+res[i].showNum+'次</div>'+
                        '</li>';
                    }
                    setTimeout(function(){
                        $('.list').html(str);
                        me.resetload();
                        me.unlock();
                        me.noData(false);
                    },1500);
                }else{
                    me.noData();
                    me.resetload();
                    dlctipbox.show(res.msg);
                }
            });
        },
        loadDownFn : function(me){
            page++;
            dlc_request('/api/advtotal/advOnLineList',{'page':page,'limit':10,'advId':getUrlParam('id')}, function(res){
                console.log(res);
                if(res.code == 1){
                    var str = '';
                    if(page == 1){
                        totalPage = res.page.totalPage;
                    }
                    var res = res.page.list;
                    if(page<=totalPage){
                        me.lock();
                        me.noData();
                    }
                    for(var i in res){
                        str+='<li class="flex bw">'+
                                '<div class="flex1">'+format(res[i].createTime,'Y-m-d')+'</div>'+
                                '<div class="flex1">'+res[i].clickNum+'次</div>'+
                                '<div class="flex1">'+res[i].showNum+'次</div>'+
                                '</li>';
                    }
                    // 为了测试，延迟1秒加载
                    setTimeout(function(){
                        $('.list').append(str);
                        me.resetload();
                    },1000);
                }else{
                    dlctipbox.show(res.msg);
                    me.noData();
                    me.resetload();
                }
            });
        },
        threshold : 50
    });
    $('.look').click(function(){
        location.href = './ad_statistical.html?id='+getUrlParam('id');
    });
</script>



















